package com.jizhi.onework.dataobj.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jizhi.onework.framework.model.BaseVO;
import com.jizhi.onework.pojo.User;
import org.springframework.data.annotation.Transient;

import java.util.Date;

/**
 * 用户视图对象
 *
 * @author hzhang7
 */
public class UserVO extends BaseVO {

    private Long id;

    @Transient
    private String password;

    private String phone;

    private String headImg;

    private String name;

    private String userName;

    private Long roleId;

    @Transient
    private String salt;

    private String email;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    /**
     * 登录成功返回token
     */
    private String token;

    /**
     * 构造函数
     */
    public UserVO() {
    }

    /**
     * 构造函数
     */
    public UserVO(User user) {
        this.id = user.getId();
        this.createTime = user.getCreateTime();
        this.lastLoginTime = user.getLastLoginTime();
        this.password = user.getPassword();
        this.phone = user.getPhone();
        this.updateTime = user.getUpdateTime();
        this.headImg = user.getHeadImg();
        this.name = user.getName();
        this.userName = user.getUserName();
        this.roleId = user.getRoleId();
        this.salt = user.getSalt();
        this.email = user.getEmail();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return super.toString();
    }
}
